import * as Api from '@/api/school/index'
const ListMixin = {
	data(){
		return{
			pageOptions:{
				pageSize:50,
				current:1
			},
			detail:{},
			queryParams:{}
		} 
	},
	
	onLoad(options) {
		console.log(options,'options')
		this.queryParams[this.idKey] = options[this.idKey]
		this.getDetail()
	},
	methods:{
		
		/**
		 * 加载页面数据
		 * @param {Object} callback
		 */
		getDetail(callback) {
		  let params = this.getQueryParams()
		  Api[this.url.detail](params)
		    .then(result => {
		      this.detail = result.data
		      // 设置顶部导航栏栏
		    })
		    .finally(() => callback && callback())
		},
		getQueryParams(){
			let params = Object.assign({},this.queryParams)
			return params
		},
		
		/**
		 * 跳转文章详情页
		 * @id 对应的id
		 * @key page取值
		 */
		onTargetDetail(id,key) {
		  uni.navigateTo({
		    url:this.pages[key] + id
		  })
		},
	}
}
export default ListMixin